import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:note/pages/home_page/view.dart';
import 'package:note/pages/unlock_app_page/view.dart';
import 'logic.dart';

class RootPage extends StatelessWidget {
  RootPage({Key? key}) : super(key: key);

  final logic = Get.put(RootLogic());
  final state = Get.find<RootLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Obx(() => baseContent()),
    );
  }

  Widget baseContent() {
    if (state.name.value == RootPageNameHome) {
      return HomePage();
    }
    if (state.name.value == RootPageNameUnlock) {
      return UnlockAppPage();
    }
    return Container();
  }
}
